#pragma once

#include "fxcc/core/platform/common/App.h"
#include "fxcc/core/platform/win32/pch.h"
#include "fxcc/core/platform/win32/WinTimer.h"

namespace fxcc
{
	namespace platform
	{
		namespace win32
		{
			struct FXCC_API App :public fxcc::platform::common::App
			{
				WinTimer m_WinTimer;

				App(const common::App::Desc& desc);

				bool Init();

				bool InitWin32();

				int Run();

				void OnDestroy();

				virtual LRESULT WINAPI OnWndProj(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);

				void DestroyWin32();

				void OnJoystick();

				void OnUpdate();

			public:
				HWND m_hWnd;

				LPCWSTR m_lpClassName;

				HINSTANCE m_hInstance;

				unsigned short lastState;

				unsigned short currentState;

			private:
				void HandleMouseInput(UINT msg, WPARAM wParam, LPARAM lParam);

				void HandleKeyInput(UINT msg , WPARAM wParam, LPARAM lParam);

			public:
				virtual void OnFramebuffersize(int w, int h);

				const WinTimer& GetTimer() const
				{
					return m_WinTimer;
				}
			};
		}
	}
}